package com.javaai.project.controller;

import com.javaai.project.ai.DoctorAssistant;
import com.javaai.project.utils.ChatForm;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import reactor.core.publisher.Flux;

@Tag(name = "智能助理")
@RestController
@RequestMapping("/doctor")
public class DoctorController {

    @Autowired
    private DoctorAssistant doctorAssistant;

    @Operation(summary = "流式对话")
    @PostMapping(value = "/chat", produces = "text/stream;charset=utf-8")
    public Flux<String> streamChat(@RequestBody ChatForm chatForm)  {
        return doctorAssistant.streamChat(chatForm.getMemoryId(), chatForm.getMessage());
    }

}
